package pers.mobian.springcloud.service;

import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import pers.mobian.springcloud.pojo.Dept;

import java.util.List;


@Component
public class DeptClientServiceFallbackFactory implements FallbackFactory {
    public DeptClientService create(Throwable cause) {
        return new DeptClientService() {
            public boolean addDept(Dept dept) {
                return false;
            }

            public Dept queryById(Long id) {
                return new Dept()
                        .setDeptno(id)
                        .setDname(id + "没有找到")
                        .setDb_source("没有找到这个数据库");
            }

            public List<Dept> queryAll() {
                return null;
            }
        };
    }
}
